<template>
	<view class="wrapper">
		<uni-nav-bar leftIcon="arrowleft" title="群公告" @clickLeft="$back" rightText="发布" @clickRight="update()" backgroundColor="#F2F3F5" color="#333333"></uni-nav-bar>
		<view class="write_note">
			<textarea type="text" value="" placeholder="填写公告,1~600字" class="notice" v-model="notice" />
		</view>
	</view>
</template>

<script>
import uniNavBar from '@/components/uni-nav-bar/uni-nav-bar.vue';
export default {
	data() {
		return {
			notice: '',
			roomid:''
		};
	},
	onLoad(e) {
		this.roomid=e.roomid
	},
	methods: {
		update() {
			if (this.notice == '') {
				this.$sToast('公告不能为空');
				return;
			}
			this.$ajax(
				this.apiList.update,
				{
					roomId: this.roomid,
					notice: this.notice
				},
				'POST'
			).then(res => {
				this.$sToast('公告发布成功');
				this.$back(1, 1500);
			});
		}
	},
	components: {
		uniNavBar
	}
};
</script>

<style lang="scss">
.wrapper {
	background-color: #f3f3f3;
}
.write_note {
	height: 540rpx;
	background-color: #ffffff;
	padding: 29rpx 0 0 31rpx;
	textarea{
		width: 100%;
		height: 100%;
	}
}
</style>
